#ifndef MTM_EX2_H_
#define MTM_EX2_H_

#include <stdio.h> // For FILE*
				   // You should avoid including unnecessary header files
#include <stdbool.h>

/**
 * Maximal input line length
 */
#define MAX_LEN 120

/**
 * This type defines all errors for the system.
 * These codes should be used for calling mtmPrintErrorMessage to report
 * error messages.
 *
 * Notice that after calling mtmPrintErrorMessage with one of the first
 * three messages you should abort the program according to the exercise's
 * rules
 */
typedef enum {
	MTM_OUT_OF_MEMORY, // You should exit program after this error
	MTM_INVALID_COMMAND_LINE_PARAMETERS, // You should exit the program after
										 // this error
	MTM_CANNOT_OPEN_FILE, // You should exit program after this error
	MTM_CAR_ALREADY_EXISTS,
	MTM_CAR_IN_USE,
	MTM_CAR_DOES_NOT_EXISTS,
	MTM_CAR_ALREADY_ON_SALE,
	MTM_SALE_PRICE_TOO_BIG,
	MTM_CAR_NO_SALE,
	MTM_CUSTOMER_ALREADY_EXISTS,
	MTM_INVALID_CUSTOMER_ID,
	MTM_NO_CARS,
	MTM_NO_SALES,
	MTM_NO_OPEN_BILLS,
	MTM_INVALID_PRICE,
	MTM_INVALID_KM,
	MTM_INVALID_CAR
} MtmErrorCode;

/**
 * mtmPrintErrorMessage - prints an error message into the given output channel
 * Use the standard error channel to print error messages.
 *
 * @param errorChannel - File descriptor for the error channel
 * @param code - Error code to print message for.
 */
void mtmPrintErrorMessage(FILE* errorChannel, MtmErrorCode code);

/**
 * Prints the monthly statistics for the checkout
 * @param output - An output channel to print to
 * @param rentedCars - The amount of rented cars this month
 * @param totalSales - The total sales for this month in agorot
 * @param averageSale - The average bill.
 */
void mtmPrintMonthly(FILE* output, int rentedCars, int totalSales,
        int averageSale);

/**
 * Prints the header of a detailed bill report
 * @param output - An output channel to print to
 * @param id - The customer name
 * @param id - The id number of the customer
 */
void mtmPrintBillHeader(FILE* output, const char* name, int id);

/**
 * Prints one regular line in the detailed bill report
 * @param output - An output channel to print to
 * @param name - The name of the rented car
 * @param license - The license number of the rented car
 * @param km - The distance the car drove
 * @param price - The price each km in agorot
 */
void mtmPrintBillLine(FILE* output, const char* name, int license, int km, int price);

/**
 * Prints a discount line in a bill.
 * @param output - An output channel to print to
 * @param name - The name of the rented car
 * @param license - The license number of the rented car
 * @param km - The distance the car drove
 * @param price - The total price in agorot
 */
void mtmPrintBillDiscountLine(FILE* output, const char* name, int license, int km, int price);

/**
 * Prints the final line a bill containing the sum of all previous payments
 * @param output - An output channel to print to
 * @param total - The sum of all previous payments 
 */
 void mtmPrintBillTotal(FILE* output, int total);

/**
 * Prints the details of one car in the system
 * @param output - An output channel to print to
 * @param name - The printable name of the car
 * @param license - the car license number
 * @param km - the total distance the car drove
 * @param price - The normal rent price per km
 * @param onSale - indicate id there is currently a sale on this car
 */
void mtmPrintCar(FILE* output, const char* name, int license, int km, int price, bool onSale);

/**
 * Prints a small identifier line for a customer bill
 * @param output - An output channel to print to
 * @param name - The name of the customer
 * @param id - The id of the customer
 * @param lines - The number of current bill lines
 * 				 (number of cars returned since last payment)
 */
void mtmPrintCustomer(FILE* output, const char* name, int id, int lines);

#endif /* MTM_EX2_H_ */
